from fastapi import APIRouter

from app.corelibs.http_response import partner_success
from app.schemas.point_management.my_application_schemas import UserApplySchemas
from app.services.point_management.my_application_services import UserApplyService

router = APIRouter()


@router.post('/userApplyList', description="申请列表")
async def user_apply_list(params: UserApplySchemas):
    data = await UserApplyService.list(params)
    return partner_success(data)


@router.post('/detail', description="申请列表")
async def user_apply_detail_list(params: UserApplySchemas):
    data = await UserApplyService.detail(params)
    return partner_success(data)


@router.post('/userApplySaveOrUpdate', description="更新申请")
async def user_apply_save_or_update(params: UserApplySchemas):
    data = await UserApplyService.save_or_update(params)
    return partner_success(data)


@router.post('/undo', description="撤銷申请")
async def user_apply_undo(params: UserApplySchemas):
    data = await UserApplyService.undo(params)
    return partner_success(data)


@router.post('/approve', description="审批申请")
async def user_apply_approve(params: UserApplySchemas):
    data = await UserApplyService.approve(params)
    return partner_success(data)


@router.post('/userApplyDeleted', description="删除商申请")
async def user_apply_deleted(params: UserApplySchemas):
    data = await UserApplyService.deleted(params)
    return partner_success(data)
